<div id="feedback-dialog" title="反馈建议">
    <form class="feedback-con" method="post">
        <textarea id="feedback-text" name="feedback-content" placeholder="提示：如果您希望反馈的内容得到回复,请留下您的联系方式"></textarea>
        <input type="submit" id="feedback-sent" value="发送反馈信息">
    </form>
    <script>
        $(function(){
            $(".feedback-con").validate({
                submitHandler: function (form) {
                    $.ajax({
                        url: '<?php echo base_url('api/feedback');?>',
                        type: 'post',
                        data: $(form).serialize(),
                        success: function (jsonrsp) {
                            try {
                                var rsp = $.parseJSON(jsonrsp);
                                noty({type: rsp.type, text: rsp.message, callback: {
                                    afterClose: function () {
                                        switch (rsp.type) {
                                            case 'success':
                                                location.reload();
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                }});
                            } catch (ex) {
                                noty({type: 'error', text: '发生内部错误，请联系管理员'});
                                throw ex;
                            }
                        }
                    });
                }
            });
        })
    </script>
</div>
